class BaseStationuser {
  String? id;
  String? stationId;
  String? staffId;
  String? username;
  String? createUid;
  String? createDate;
  String? writeUid;
  String? writeDate;
  String? departmentId;
  List? userid;
  String? job;
  num? postratio;

  BaseStationuser({
    this.id,
    this.stationId,
    this.staffId,
    this.createUid,
    this.createDate,
    this.writeUid,
    this.writeDate,
    this.departmentId,
    this.userid,
    this.job,
    this.username,
    this.postratio,
  });

  BaseStationuser copyWith({
    String? id,
    String? stationId,
    String? staffId,
    String? createUid,
    String? createDate,
    String? writeUid,
    String? writeDate,
  }) {
    return new BaseStationuser(
      id: id ?? this.id,
      stationId: stationId ?? this.stationId,
      staffId: staffId ?? this.staffId,
      createUid: createUid ?? this.createUid,
      createDate: createDate ?? this.createDate,
      writeUid: writeUid ?? this.writeUid,
      writeDate: writeDate ?? this.writeDate,
    );
  }

  @override
  String toString() {
    return '''BaseStationuser{
      id: id,
      stationId: stationId,
      staffId: staffId,
      createUid: createUid,
      createDate: createDate,
      writeUid: writeUid,
      writeDate: writeDate,
    }''';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is BaseStationuser &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          stationId == other.stationId &&
          staffId == other.staffId &&
          createUid == other.createUid &&
          createDate == other.createDate &&
          writeUid == other.writeUid &&
          writeDate == other.writeDate);

  factory BaseStationuser.fromMap(Map<String, dynamic> map) {
    return new BaseStationuser(
      job: (map['job_id'] != false && map['job_id'] != null)
          ? map['job_id'][1].toString() as String?
          : "",
      id: map['id'] != false ? map['id'].toString() as String? : "",
      stationId: map['station_id'] != false
          ? map['station_id'].toString() as String?
          : "",
      staffId: map['staff_id'] != null
          ? map['staff_id'][0].toString() as String?
          : map['user_id'][0].toString(),
      username: map['staff_id'] != null
          ? map['staff_id'][1].toString() as String?
          : map['name'].toString(),
      postratio: map['postratio'] != false
          ? map['postratio']
          : 0,
      createUid: map['create_uid'] != false
          ? map['create_uid'].toString() as String?
          : "",
      createDate: map['create_date'] != false
          ? map['create_date'].toString() as String?
          : "",
      writeUid: map['write_uid'] != false
          ? map['write_uid'].toString() as String?
          : "",
      writeDate: map['write_date'] != false
          ? map['write_date'].toString() as String?
          : "",
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'stationId': this.stationId,
      'staffId': this.staffId,
      'createUid': this.createUid,
      'createDate': this.createDate,
      'writeUid': this.writeUid,
      'writeDate': this.writeDate,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    List list = [
      if (this.departmentId != null && this.departmentId != '')
        ['department_id', '=', int.parse(this.departmentId!)],
      if (this.userid != null && this.userid!.length > 0)
        ['user_id', 'not in', this.userid],
      if (this.username != null && this.username != '')
        ['name', 'like', '%${this.username}%'],
    ] as List;

    // ignore: unnecessary_cast
    return list;
  }

  List toDomainListToo() {
    List list = [
      if (this.stationId != null && this.stationId != '')
        ['station_id', '=', int.parse(this.stationId!)],
      if (this.username != null && this.username != '')
        ['name', 'like', '%${this.username}%'],
    ] as List;

    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'station_id': int.parse(this.stationId!),
      'staff_id': int.parse(this.staffId!),
      'create_uid': this.createUid,
      'create_date': this.createDate,
      'write_uid': this.writeUid,
      'write_date': this.writeDate,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}
